<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/1
 * Time: 16:06
 */
namespace vendor;
use vendor\user\user;
use vendor\user\VIP1;
use vendor\user\VIP2;

require 'user\user.php';
require 'user\VIP1.php';
require 'user\VIP2.php';
//$user = new user();
//$user->register();
//$user->login();
//$user->updatepwd();

class manager{
    private $arr = [];
    public function OpenSite(){
        $this->arr[] = $this->createCommonUser();
        $this->arr[] = $this->createCommonUser();
        $this->arr[] = $this->createCommonUser();
        $this->arr[] = $this->createCommonUser();
        $this->arr[] = $this->createVip1User();
        $this->arr[] = $this->createVip2User();
    }
    public function CloseSite(){
        echo '关闭网站';
    }
    public function showOnlineNum(){
        echo '在线人数：'.user::getOnlineNum().'<br/>';
    }
    private function createCommonUser(){
        $user = new user();
        $this->showOnlineNum();
        $user->mylevel();
        return $user;
    }
    private function createVip1User(){
        $Vip1 = new VIP1();
        $this->showOnlineNum();
        $Vip1->mylevel();
        return $Vip1;
    }
    private function createVip2User(){
        $Vip2 = new VIP2();
        $this->showOnlineNum();
        $Vip2->mylevel();
        return $Vip2;
    }
    public function __destruct()
    {
        echo '<br/>清除manager对象<br/>';
    }
}
$manager = new manager();
$manager->OpenSite();
$manager->CloseSite();